import React, { Component } from 'react';
import { swiper } from '../../utils/api'
import { Swiper } from 'antd-mobile'
class MySwiper extends Component {
    state = {
        list: []
    }
    componentDidMount() {
        swiper().then((res) => {
            // console.log(res.data.list);
            this.setState({
                list: res.data.list
            })
        })

    }
    render() {
        return (
            <div className='myswiper'>
                <Swiper autoplay loop autoplayInterval='1500'>
                    {
                     this.state.list.map((item,index)=>{
                        return (
                            <Swiper.Item key={index}>
                                <img  src={item.pic} alt="" />
                                </Swiper.Item>
                        )
                     })
                    }
                </Swiper>
            </div>
        );
    }
}

export default MySwiper;